%%%-------------------------------------------------------------------
%%% @author Administrator
%%% @copyright (C) 2023, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 13. 4月 2023 19:37
%%%-------------------------------------------------------------------
-module(sc_sup).
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
  supervisor:start_link({local, ?SERVER}, ?MODULE, []).
init([]) ->
  ElementSup = {sc_element_sup, {sc_element_sup, start_link, []},
    permanent, 2000, supervisor, [sc_element]},
  EventManager = {sc_event, {sc_event, start_link, []}, % ❶ 新的sc_event进程
    permanent, 2000, worker, [sc_event]},
  Children = [ElementSup, EventManager],
  RestartStrategy = {one_for_one, 4, 3600}, % ❷ one_for_one监督者
  {ok, {RestartStrategy, Children}}.

